import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

class MeetingList {
    List<User> users;
    List<Meeting> meetings;
    Map<Class<? extends User>, NotifyStrategy> strategies;

    MeetingList() {
        this.users = new ArrayList<>();
        this.meetings = new ArrayList<>();
        this.strategies = new HashMap<>();
        strategies.put(Employee.class, new NotifyEmployeeStrategy());
        strategies.put(Department.class, new NotifyDepartmentStrategy());
    }

    void registerUser(User user) {
        users.add(user);
    }

    void unregisterUser(User user) {
        users.remove(user);
    }

    void addMeeting(Meeting meeting) {
        meetings.add(meeting);
        notifyUsers(meeting);
    }

    void notifyUsers(Meeting meeting) {
        for (User user : users) {
            NotifyStrategy strategy = strategies.get(user.getClass());
            if (strategy != null) {
                strategy.notify(meeting, user);
            }
        }
    }
}